/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author HuyNVK
 */
@Entity
@Table(name = "SEVERITY")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Severity.findAll", query = "SELECT s FROM Severity s"),
    @NamedQuery(name = "Severity.findBySeverityID", query = "SELECT s FROM Severity s WHERE s.severityID = :severityID"),
    @NamedQuery(name = "Severity.findByName", query = "SELECT s FROM Severity s WHERE s.name = :name"),
    @NamedQuery(name = "Severity.findByDescription", query = "SELECT s FROM Severity s WHERE s.description = :description")})
public class Severity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "SeverityID")
    private String severityID;
    @Basic(optional = false)
    @Column(name = "Name")
    private String name;
    @Column(name = "Description")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "severityID")
    private Collection<Defectlog> defectlogCollection;

    public Severity() {
    }

    public Severity(String severityID) {
        this.severityID = severityID;
    }

    public Severity(String severityID, String name) {
        this.severityID = severityID;
        this.name = name;
    }

    public String getSeverityID() {
        return severityID;
    }

    public void setSeverityID(String severityID) {
        this.severityID = severityID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<Defectlog> getDefectlogCollection() {
        return defectlogCollection;
    }

    public void setDefectlogCollection(Collection<Defectlog> defectlogCollection) {
        this.defectlogCollection = defectlogCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (severityID != null ? severityID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Severity)) {
            return false;
        }
        Severity other = (Severity) object;
        if ((this.severityID == null && other.severityID != null) || (this.severityID != null && !this.severityID.equals(other.severityID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Severity[ severityID=" + severityID + " ]";
    }
    
}
